<#macro scriptMacro>
  <script>
    layui.use(['form'], function () {
      var form = layui.form,
          layer = layui.layer,
          $ = layui.$;

      $("#saveBtn").on('click', function () {
        $.post("${request.contextPath}/tag/save", $("#tagForm").serialize(), function (result) {
          layMsg(result.msg);
          if (result.success) {
            var iframeIndex = parent.layer.getFrameIndex(window.name);
            parent.reloadTable();
            parent.layer.close(iframeIndex);
          }
        })
      })
    });
  </script>
</#macro>
<#macro styleMacro>
  <style>

  </style>
</#macro>

<@zlt.page scriptMacro=scriptMacro styleMacro=styleMacro>
  <body>
  <form class="layui-form layuimini-form" id="tagForm">
    <input type="hidden" name="id" <#if articleTag.id??>value="${articleTag.id?c}"</#if>/>
    <div class="layui-form-item">
      <label class="layui-form-label required">标签名称</label>
      <div class="layui-input-block">
        <input type="text" name="tagName" placeholder="请输入标签名称" value="${articleTag.tagName!}" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label required">状态</label>
      <div class="layui-input-inline">
        <select name="tagStatus">
            <#list tagStates as s>
              <option value="${s.value}" <#if s.value==articleTag.tagStatus!>selected</#if>>${s.desc}</option>
            </#list>
        </select>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">图标</label>
      <div class="layui-input-block">
        <input type="text" name="tagIcon" placeholder="输入图标样式" value="${articleTag.tagIcon!}" class="layui-input">
        <tip>本项目使用element或fontawesomeV5的图标</tip>
        <tip>留空会使用 <i class="fas fa-tag"></i> 样式</tip>
        <tip>传送门 <a href="https://fontawesome.com/" target="_blank" style="color: #00b7ee">fontawesome</a> |
          <a href="https://element.eleme.cn/#/zh-CN/component/icon" target="_blank" style="color: #00b7ee">element-ui</a></tip>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">特殊样式</label>
      <div class="layui-input-block">
        <textarea name="tagCss" placeholder="输入特殊样式" class="layui-textarea">${articleTag.tagCss!}</textarea>
        <tip>特殊样式会在显示标签时插入标签的 style 中</tip>
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn layui-btn-sm" id="saveBtn" type="button">保 存</button>
      </div>
    </div>
  </form>
  </body>
</@zlt.page>